package com.eastfair.common.api;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.core.base.R;
import com.eastfair.pay.dto.PaymentPlanDTO;
import com.eastfair.pay.dto.PaymentPlanPageQuery;
import com.eastfair.pay.vo.PaymentPlanVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "mice-pay/paymentPlan")
public interface PaymentPlanFeign {

    /**
     * 更新付款计划
     * @param paymentPlanDTOs
     * @return
     */
    @PostMapping("/saveOrupdate")
    R saveOrupdate(@RequestBody @Validated List<PaymentPlanDTO> paymentPlanDTOs);

    @GetMapping("/delete/{planId}")
    R delete(@PathVariable("planId") Long planId);


    /**
     * 获取合同付款计划
     * @param contractId
     * @return
     */
    @GetMapping("/queryByContractId/{contractId}")
    R<List<PaymentPlanVO>> queryByContractId(@PathVariable("contractId") Long contractId);


    /**
     * 获取合同付款计划
     * @param params
     * @return
     */
    @PostMapping("/queryPage")
    R<Page<PaymentPlanVO>> queryPage(@RequestBody @Validated PageParams<PaymentPlanPageQuery> params);

    /**
     * 计划付款时间范围查询未付款的付款计划.
     *
     * @param startPlanPayTime the start plan pay time
     * @param endPlanPayTime   the end plan pay time
     * @return the r
     */
    @GetMapping("query/planPayTime")
    R<List<PaymentPlanVO>> queryByPlanPayTime(@RequestParam("startPlanPayTime") String startPlanPayTime,
                                              @RequestParam("endPlanPayTime") String endPlanPayTime);
}
